<%@page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="DBConnection.DB"%>
<%@page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>table</title>
		<link href="../../css/layer.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../../js/jquery-ui-1.8.21.custom.min.js"></script>
	</head>
  
  <body>
    <%
    	String loctype = request.getParameter("loctype");
		String quyu = request.getParameter("quyu");
		String zhibiao = request.getParameter("zhibiao");
		DB db = new DB();
		db.ConnectDB();
		ResultSet rs = null;
		String sql="select count(*),"+zhibiao+" from 大型仪器 ";
		if(loctype.equals("city"))
			sql += " where 所在市='"+quyu+"'";
		else 
		if(loctype.equals("xian"))
			sql += " where 所在区县='"+quyu+"'";
		else 
		if(loctype.equals("danwei"))
			sql += ",单位 where 所属单位编号=单位编号 and 单位名称='"+quyu+"'";
		sql += " group by "+zhibiao+" order by count(*) desc ";
		System.out.println(sql);
		
     %>
     	<div class="table_list">
			<table class="table1" width="100%" cellpadding="0" cellspacing="0">
				<tr class="tr_bt">
					<td class="td2">
						<%=zhibiao %>
					</td>
					<td class="td2">
						数量
					</td>
				</tr>
				<%
					rs = db.sm.executeQuery(sql);
					while (rs.next()) {
				%>
				<tr class="tr_1">
					<td class="td2">
					<%=rs.getString(2)%>
					</td>
					<td class="td8" style="border-right: none;"><a href="dxyqtable1.jsp?quyu=<%=quyu%>&loctype=<%=loctype%>&zhibiao=<%=zhibiao%>&zhibiaomc=<%=rs.getString(2)%>"><%=rs.getString(1)%></a></td>
				</tr>
				<%
				}
				db.CloseDB();
				 %>
				</table>
				</div>
				<script>
				window.parent.$("#fanhui").hide();
				</script>
       </body>
</html>
